<% unless current_user.nil? and @comments.blank? %>

  <hr style="margin-top:3em" />
  <h2>comentarios</h2>

  <% unless @comments.blank? %>
    <div class="comments">
      <% @comments.each do |comment| %>
        <div id="comment-<%= comment.id %>" class="comment">
          <%= link_to "#{image_tag comment.user.avatar.url(:medium), :class => "avatar", :alt => ""}", comment.user %>
          <div class="inner-comment">
            <h3><%= link_to comment.user.name, comment.user %></h3>
            <%= simple_format(h(comment.body)) %>
            <p class="created-time"><abbr class="timestamp" title="<%= Time.now %>" class="timestamp">hace <%= distance_of_time_in_words Time.now, comment.updated_at %></abbr></p>
          </div>
        </div>
      <% end %>
    </div>
  <% end %>

  <% unless current_user.nil? %>
    <div id="comment-new" class="comment">
      <%= link_to "#{image_tag current_user.avatar.url(:medium), :class => "avatar", :alt => ""}", current_user %>
      <div class="inner-comment">
      <% form_for @comment, :url => recipe_comments_path(@recipe) do |f| %>
        <div class="field">
          <%= f.label :body, current_user.name %>
          <%= error_messages_for :body %>
          <%= f.text_area :body %>
        </div>
        <p id="submit">
          <%= f.submit 'comentar' %>
        </p>
      <% end %>
    </div>
  </div>
  <% end %>

<% end %>
